<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <style>
        .layui-table th {
            font-size: 16px;
            font-weight: 600;
        }
    </style>
</head>
<body>
<div class="layui-fluid">

    <div class="layui-card">
        <div class="layui-card-body">
            <table lay-filter="dimensionalSummaryLists" id="dimensionalSummaryList" class="layui-table"
                   style="margin:0px;"></table>
            <div style="padding-top: 5px;">
                <div style="text-align: right"> 制表人：${user.name}<input type="text"
                                                                               style="visibility:hidden;width:20px;">
                    制表时间：${datetime}&nbsp;
                </div>
            </div>
        </div>

    </div>
</div>
<script type="text/html" id="dimensionalSummaryLists">
    <div class="layui-inline" lay-event="exports" title="导出">
        <i class="layui-icon layui-icon-export"></i>
    </div>
</script>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script>
    layui.use(['table'], function () {
        var $ = layui.$
            , table = layui.table;

        $.ajax({
            type: "post",
            url: "<%=request.getContextPath()%>/rest/reporting/dimensionalSummaryTable",
            dataType: "json",
            async: false,
            success: function (data) {
                table.render({
                    elem: '#dimensionalSummaryList'
                    , url: "<%=request.getContextPath()%>/rest/reporting/dimensionalSummaryList"
                    ,title:"负责部门类别物资二维汇总表"
                    , height: 'full-100'
                    , page: false
                    , text: {
                        none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
                    }
                    , totalRow:true
                    , toolbar: '#dimensionalSummaryLists'
                    , defaultToolbar:['filter','print']
                    , cols: [data.First,data.Second,data.Three,data.Four]
                    //     [
                    //     [
                    //         {title: '部门类别物资二维汇总表',align:'center', width: '100%', colspan: 13} //rowspan即纵向跨越的单元格数
                    //     ],
                    //     [
                    //         {title: '统计区间：',align:'right',  width: '100%', colspan: 13} //rowspan即纵向跨越的单元格数
                    //     ],
                    //     [{field: 'number', title: '序号',align:'center', width: '4%',rowspan:2}
                    //         , {field: 'category', title: '类别名称',align:'center',width: '8%',rowspan:2,totalRowText: '部门合计'}
                    //         , {title: '部门',align:'center',width: '20%',colspan: 5}
                    //         , {title: '部门',align:'center',width: '20%',colspan: 5}
                    //         , {field: 'count', title: '类别合计',width: '8%',align:'center',rowspan:2,totalRow: true}
                    //     ],
                    //     [
                    //           {field: 'one1', title: '物资总数',align:'center',totalRow: true}
                    //         , {field: 'one2', title: '在库数量',align:'center',totalRow: true}
                    //         , {field: 'one3', title: '出库数量',align:'center',totalRow: true}
                    //         , {field: 'one4', title: '维保数量',align:'center',totalRow: true}
                    //         , {field: 'one5', title: '报废数量',align:'center',totalRow: true}
                    //         , {field: 'one6', title: '物资总数',align:'center',totalRow: true}
                    //         , {field: 'one7', title: '在库数量',align:'center',totalRow: true}
                    //         , {field: 'one8', title: '出库数量',align:'center',totalRow: true}
                    //         , {field: 'one9', title: '维保数量',align:'center',totalRow: true}
                    //         , {field: 'one10', title: '报废数量',align:'center',totalRow: true}
                    //
                    //     ]
                    // ],
                });

            }
        });


        //监听头工具栏事件
        table.on('toolbar(dimensionalSummaryLists)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
                , data = checkStatus.data;//获取选中的数据
            switch (obj.event) {
                case 'exports':
                    exports(data);
                    break;
            }
            ;
        });

        function exports(data) {
            var url = "<%=request.getContextPath()%>/rest/reporting/dimensionalSummaryListExcel?typename=负责部门类别物资二维汇总表";
            window.open(url);
        }
    });
</script>
</body>
</html>